package amani.wechat.platform.controller;

import javax.servlet.http.HttpServletRequest;

import org.jeewx.api.core.exception.WexinReqException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import amani.wechat.platform.controller.model.AddCardReturnData;
import amani.wechat.platform.utils.WxUtils;

@Controller
@RequestMapping("/CardTest")
public class CardTestController {

	@RequestMapping("/Index")
	public String Index() {
		
		return "cardTest/index";
	}
	
	@RequestMapping("/SendCard") 
	@ResponseBody 
	public AddCardReturnData SendCard(HttpServletRequest request) throws WexinReqException {
		AddCardReturnData result=new AddCardReturnData();
		result.setCardId("prCjajpXHPvayBLLMtFsDRRAiXs8"); 
		String openid=(String)request.getSession().getAttribute("openid");
		result.setCardExt(WxUtils.getCardExt("prCjajpXHPvayBLLMtFsDRRAiXs8","123443211234790X", openid)); 
		
		return result;
		
	}
}
